Controlling high-pressure production trap separation efficiency

ABSTRACT

A computer-implemented method can include implementing a feedback control scheme including controlling a separation efficiency for a high-pressure production trap (HPPT) by manipulating the demulsifier concentration. Controlling the separation efficiency can include determining, as a function of temperature and based on correlations of historical process data, minimum and maximum target separation efficiencies; identifying a target separation efficiency that is between the minimum and maximum target separation efficiencies; and adjusting a demulsifier dosage, used in calculating the separation efficiency, between a minimum demulsifier concentration and a maximum demulsifier concentration. The adjusting can include: when the separation efficiency is below the target separation efficiency, adjusting, using a PID controller, the demulsifier dosage upward but not to exceed a maximum dosage concentration; and when the separation efficiency is above the target separation efficiency, adjusting, using the PID controller, the demulsifier dosage downward above a minimum dosage concentration.

BACKGROUND

Oil companies operate processes and pipelines that can include, inaddition to oil, produced water that is in an emulsion form. Demulsifierchemicals can be added to oil-water emulsions in upstream pipelines orin a crude desalting process in order to enhance separation of waterfrom oil.

SUMMARY

The present disclosure describes methods and systems, includingcomputer-implemented methods, computer program products, and computersystems for controlling demulsifier injection in response to processchanges such as crude temperature, oil well line-up, and feed rates. Forexample, a high-pressure production trap (HPPT) separation efficiencyset point, which is a percentage of water separated in HPPT versus totalproduced water, can be adjusted by increasing and decreasing ademulsifier dosage within predefined limits.

In an implementation, a computer-implemented method can includeimplementing a feedback control scheme including controlling aseparation efficiency for a high-pressure production trap (HPPT) bymanipulating the demulsifier concentration. Controlling the separationefficiency can include determining, as a function of temperature andbased on correlations of historical process data, a minimum targetseparation efficiency and a maximum target separation efficiency;identifying a target separation efficiency that is between the minimumtarget separation efficiency and the maximum target separationefficiency; and adjusting a demulsifier dosage, used in calculating theseparation efficiency, between a minimum demulsifier concentration and amaximum demulsifier concentration. The adjusting can include: when theseparation efficiency is below the target separation efficiency,adjusting, using a PID controller, the demulsifier dosage upward but notto exceed a maximum dosage concentration; and when the separationefficiency is above the target separation efficiency, adjusting, usingthe PID controller, the demulsifier dosage downward above a minimumdosage concentration.

The previously described implementation is implementable using acomputer-implemented method; a non-transitory, computer-readable mediumstoring computer-readable instructions to perform thecomputer-implemented method; and a computer-implemented systemcomprising a computer memory interoperably coupled with a hardwareprocessor configured to perform the computer-implemented method/theinstructions stored on the non-transitory, computer-readable medium.

The subject matter described in this specification can be implemented inparticular implementations so as to realize one or more of the followingadvantages. First, the proposed techniques can improve on or eliminatemanual control of HPPT separation performance in which operators areleft to determine the demulsifier dosage manually, which can lead tooverdosing or under-dosing. Second, techniques can resolve unstabledehydrator flow that include large swings in dehydrator water flow dueto an uncontrolled percentage of water separated in the HPPT. Forexample, the instability can impact water oil separator level controland salt water injection pump efficiency. Third, techniques can improvesystems that are prone to overdosing of demulsifier, such as injectingmore demulsifier than is needed and that leads to higher operatingexpenditures. Fourth, techniques can improve systems that are prone tounder-dosing of demulsifier, such as injecting less demulsifier thanneeded, which can lead to process upsets. Fifth, techniques can replaceschemes that use rule based logic and that are not true feedbackschemes. Sixth, techniques can replace systems that do not controlseparation performance of the HPPT because, for example, the systems donot incorporate maximum or minimum limits for demulsifier to prevent thesystem from overdosing or under-dosing. Seventh, the techniques can besimple and transparent for engineering to tune and adjust as necessary,requiring minimal operator input. For example, the system can be easilyenhanced by adding additional control blocks, such as for control ofproduct BS&W, salt-in-crude, or for other reasons. Eighth, the processcan be marketed as a solution to operators of gas-oil separationprocesses that require enhanced demulsifier injection control forseparation of emulsions from oil or hydrocarbons. Ninth, the schemeallows for the addition of as many inputs, such as dehydrator emulsionprofile, desalter emulsion profile, and other inputs, to override therequired demulsifier concentration set point. Tenth, the scheme allowsfor the incorporation of more controller outputs, such as thedemulsifier concentration set point for additional demulsifier injectionpoints at other locations of the process. Eleventh, the scheme isadjustable to allow for control of HPPT separation efficiency in a GOSPwith more than one increment. Other advantages will be apparent to thoseof ordinary skill in the art.

The details of one or more implementations of the subject matter of thisspecification are set forth in the accompanying drawings and thedescription below. Other features, aspects, and advantages of thesubject matter will become apparent from the description, the drawings,and the claims.

DESCRIPTION OF DRAWINGS

FIG. 1 is a schematic of an example generic wet crude handlingconfiguration, according to an implementation.

FIG. 2 is a block diagram illustrating an example smart demulsifiercontrol architecture, according to an implementation.

FIGS. 3A-3E collectively illustrate a block diagram of an exampleintegration of a control scheme and various processes, according to animplementation.

FIG. 4 is a flowchart illustrating an example method for controllinghigh-pressure production trap (HPPT) separation efficiency, according toan implementation.

FIG. 5 is a block diagram illustrating an exemplary computer system usedto provide computational functionalities associated with describedalgorithms, methods, functions, processes, flows, and procedures asdescribed in the instant disclosure, according to an implementation.

Like reference numbers and designations in the various drawings indicatelike elements.

DETAILED DESCRIPTION

The following detailed description describes adjusting demulsifierinjection rates to control high-pressure production trap (HPPT)separation efficiency, and is presented to enable any person skilled inthe art to make and use the disclosed subject matter in the context ofone or more particular implementations. Described is an overall designof a smart demulsifier control (SDC) scheme and proposed use ofreconciled values for estimating HPPT efficiency, a modeling and tuningstrategy of various control blocks, and a determination of individualtuning parameters. Various modifications to the disclosedimplementations will be readily apparent to those of ordinary skill inthe art, and described principles may be applied to otherimplementations and applications without departing from scope of thedisclosure. Thus, the present disclosure is not intended to be limitedto the described or illustrated implementations, but is to be accordedthe widest scope consistent with the principles and features disclosedherein.

The SDC scheme can implement a feedback control that focuses oncontrolling the reconciled HPPT separation efficiency by manipulatingthe demulsifier concentration or in other ways. The following are thefeatures of the SDC scheme. Empirical models based on historical processdata can be used to determine the minimum achievable separationefficiency as a function of temperature. An operator has the flexibilityto increase the expected separation performance by a certain margin. Tomeet a target separation efficiency, the demulsifier dosage can beadjusted between minimum and maximum demulsifier concentrations, whichcan be determined through empirical models as a function of temperature.If a current separation is above or below the minimum target separationefficiency, then the demulsifier dosage can be adjusted up to or down tothe max/min limits respectively using a standard proportional integralderivative (PID) controller. In case of an upset in the dehydrator,another PID controller with more aggressive tuning can override therequired demulsifier concentration to be higher to mitigate the upset.The efficiency calculations can be based on reconciled values to accountfor instrument measurement errors and closure of the water balance.

Primary objectives of the SDC scheme can include controlling theseparation of the water from the HPPTs, at a desired HPPT separationefficiency, to maintain a steady water load to the desalting train bymanipulating the demulsifier concentration. This is an improvement oversystems, for example, that only control salt-in-crude or the fluiddensity profile of the oil. The SDC scheme can utilize calculationblocks for on-line monitoring of separation parameters and PID blocksfor controlling them, using built-in distributed control system (DCS)functionality. The SDC can be based on basic flow and temperaturemeasurements, so as not to require analyzers such as water-cut meters.Additional blocks can be added to control bottoms sediment & water(BS&W), salt-in-crude if reliable analyzers and vessel density profilersare installed. Demulsifier concentration limits (as function of crudetemperature) derived from process data can be incorporated in the logic.

Initiatives for improving crude quality can include, for example, newtechniques for the control of demulsifier injection. For example, theSDC can include techniques such as a feedback mechanism for maintaininga separation efficiency in a HPPT, including a proper operating windowin which demulsifier concentration is manipulated and controlled. TheSDC can include several calculations and PID functional blocks that aredescribed in this document. A detailed process analysis of theseparation performance can be used to establish a basis of strategies ofthe SDC.

Although an SDC scheme is applicable as a concept across differentgeneric gas-oil separation plants (GOSPs), calculations that are used tomeasure online separation and reasonable limits for demulsifierconsumption have to be developed on a case-by-case basis, as there canbe several factors that impact separation. Factors related to feed caninclude, for example, a crude type, a water cut, an emulsion separationindex, and a pipe velocity, for example, indicating a presence of slugs.Factors related to design can include, for example, factors associatedwith HPPT design (including retention time and internals) anddemulsifier mixing devices. Factors related to chemicals can include,for example, a demulsifier efficiency to enhance separation, which canbe affected by a formula used and a process effect. Factors related totemperature, for example, can include a separation efficiency, typicallyincreasing with temperature.

In some implementations, a typical GOSP can include equipment identifiedin Table 1:

TABLE 1 Typical GOSP Equipment GOSP Equipment Equipment Description HPPTThe HPPT separates gas at high pressure (150-450 psig) from the crudeoil. It can operate as a three-phase separator to separate free wateralso. Demulsifier This demulsifier injection skid injects demulsifierchemical at the Injection Skid production header. Demulsifier breaksemulsions to allow for separation of free water in the high-pressureproduction trap and assist in crude desalting. LPPT The low pressureproduction trap (LPPT) separates gas at low pressure (50 psig) from thecrude oil. Charge Pumps The charge pumps pressure the crude oil from theLPPT to discharge into the crude oil desalting train. Dehydrator Thedehydrator, which receives crude from the charge pumps, is the firststage electrostatic coalescer of the desalting train to remove the bulkemulsions from the crude oil under an electrostatic field. Mixing ValveThe mixing valve station shears injection wash water to mix withresidual Station produced water. This will bring the average salinity ofthe water in the oil. Desalter The desalter is the second-stageelectrostatic coalescer of the desalting train. It removes the remainingproduced water along with injected wash water to produce dry anddesalted crude (at 0.2% BS&W and 10 PTB) WOSEP The water-oil separator(WOSEP) de-oils the produced water from the HPPT, dehydrator anddesalter to less than 100 milligrams per liter Disposal Water Thedisposal water injection pumps discharge water into disposal wells forInjection Pumps maintaining reservoir pressure

The following terms apply to this disclosure. A “demulsifierconcentration” is a measurement of concentration, typically in parts permillion (ppm), of demulsifier chemical in the total fluid, such as afluid including oil and water. An “HPPT separation efficiency” is apercentage of water separated in the HPPT versus the total water removedat the GOSP. An “HPPT retention time” is a time, in minutes, for waterto separate from crude in an HPPT separation compartment, such as anupstream water weir.

GOSP configurations can serve as a basis for understanding the SDC. Forexample, to achieve goals of the SDC scheme, it is important to considerthe GOSP configuration. This is because the GOSP configuration would beused to determine the best possible control scheme, including the numberof production manifolds, HPPTs, line-up options between manifolds andHPPTs, and mode of operation of each HPPT, such as whether the mode isthree-phase or 2-phase. A demulsifier is normally added upstream of theHPPT through an automatic flow control.

FIG. 1 is a schematic of an example generic wet crude handlingconfiguration 100, according to an implementation. As illustrated inFIG. 1, using the SDC, free water can be knocked-out at an HPPT 102, andremaining water can be separated in a dehydrator 104 before a wash waterinjection upstream desalter 106. The SDC can be based on the onlineseparation measured at HPPT 102. A target of the process is to avoid bigchanges in water inlet to the dehydrator, so operation can be smooth tominimize disturbances in the interface profile.

To determine a proper HPPT separation value, for example, a water massbalance can be performed around a water oil separator (WOSEP) 110 toensure that calibration errors are corrected so as not to affect thecontrol. Validation software can be used for data reconciliation toensure that the water mass balance is closed and accurate separationefficiencies can be determined.

As illustrated in FIG. 1, HPPTs 102 and 108 feed into a low-pressureproduction trap (LPPT) 114, which feeds charge pumps 118. Desalter 106and other elements 117 also feed the WOSEP 110, as wash water from thedesalter 106 can discharge to the WOSEP 110 directly. The desalter 106is fed by the output of wash water pumps 122 that are fed by a degassingvessel 124. The WOSEP 110 feeds salt water injection wells 126, whichprovide output to water injection wells 128. Output of desalter 106feeds shipper pumps 130 which provides output to dry crude productpipeline 131.

FIG. 2 is a block diagram illustrating an example smart demulsifiercontrol architecture 200, according to an implementation. As illustratedin FIG. 2, the SDC architecture 200 includes a first control layer 201that ensures that demulsifier concentration can be maintained regardlessof crude and/or water flow oscillations. In some implementations,variables used in the first control layer 201 can include the following.A controlled variable can be used as a demulsifier concentration,measured in parts per million over the total liquid flow. A manipulatedvariable can be used as a demulsifier flow set point. Disturbancesvariables can include a dry crude flow oscillation, a produced waterflow oscillation, and a demulsifier flow oscillation.

Components in the SDC architecture 200 include the followingannotations. A flow indication (FI) can indicate, for example, a flowreading from flow transmitter. A temperature indication (TI) canindicate, for example, a temperature reading from temperaturetransmitter. A process value (PV) can indicate, for example, a value ofa process variable that is being controlled. A manipulated value (MV)can indicate, for example, a controller output that triggers action of afinal control element to a control process variable. A set value (SV)can indicate, for example, a desired set point of the process variablethat is being controlled. The SDC architecture 200 also identifies oneor more instances of a flow indication controller, a PID control, anhourly average (HAV), and a GOSP.

A second control layer 203 can include master logic that once enabled,simultaneously sets the target demulsifier concentration for a requiredHPPT separation efficiency and monitors dehydrator voltage. The secondcontrol layer 203 can serve as the master of the first control layer201. In some implementations, variables used in the second control layer203 can include the following. Controlled variables can include an HPPTseparation efficiency (%) and a dehydrator voltage drops, for example,measured in volts. A manipulated variable can include a demulsifierconcentration, measured in ppm. Disturbance variables can includetemperature, which can be measured, and feed variability, which is notmeasured. The SDC architecture 200 can include design features thatprovide the capability to use the first control layer 201, such as inconcentration control, or both layers, such as in a full control scheme.

Components of the SDC architecture 200 can use the following PID blocksand controllers. A demulsifier concentration controller, for example,can adjust the demulsifier flow based on the total GOSP liquid flow,including dry crude and produced water. Moving average filters can beapplied to flow measurements prior to taking the ratio to minimize theimpact of noise on the control.

In the first control layer 201, a flow indication controller (FIC) 202can serve as a demulsifier flow controller that provides a demulsifierflow control loop. The flow can be automatically adjusted based on aflow set point of a demulsifier concentration PID block 204. Output ofthe demulsifier concentration PID block 204 is the set point of the flowindication controller (FIC) 202.

The demulsifier concentration PID controller 204 is based on thedemulsifier concentration set point and determines the requireddemulsifier dosage (in gallons per day (GPD)) to maintain aconcentration set point based on the GOSP oil and water productionrates. The required demulsifier rate is the set point of the standarddemulsifier flow control loop.

A high selector 206 can select the highest value (maximum) of twocontrollers: an HPPT separation efficiency PID controller 210 and adehydrator voltage PID controller 208. The highest value can be selectedto determine the set point of the demulsifier concentration PIDcontroller 204.

In the case that low common voltage is experienced in the dehydrator,such as with voltage drops below a voltage set point, the dehydratorvoltage PID controller 208 can increase the demulsifier concentrationset point up to a maximum allowable concentration at that temperature,such as determined from correlations of past concentration data.

The HPPT separation efficiency PID controller 210 can control theseparation of water from oil in an HPPT, such as with an “HPPTSeparation Efficiency (%).” The output of the HPPT separation efficiencyPID controller 210 can be used in a high value calculation for the setpoint of the demulsifier concentration PID controller 204. Thedemulsifier concentration can be increased if the separation efficiencyis lower than the set point. It can be decreased if separationefficiency is greater than the set point. Demulsifier concentrationlimits, including maximum and minimum, can be determined based onsite-specific process correlations.

A master logic block 212 can be the only block (or one of a few blocks)in which operator intervention is required. Access to the fullfunctionality of the master logic block 212 can be enabled for operatorswho have full permissions. The master logic block 212 can automaticallyprovide the set point for the HPPT separation efficiency PID controller210 based on an observed temperature and a margin that the operator canenter, such as up to a certain percentage greater than a minimumseparation efficiency. The operator can also disable the controllerusing the master logic block 212.

The following are at least some of the calculations performed in theSDC. Each calculation can include a number of parameters that can beadjusted if required.

A demulsifier concentration 214 at the HPPT can be based on total fluid,with a demulsifier flow being an instantaneous demulsifier flow in GPD,given by Equation (1):

$\begin{matrix}{{{Demulsifier}\mspace{14mu} {Concentration}\mspace{14mu} ({ppm})} = {\frac{{Demulsifier}\mspace{14mu} {flow}\mspace{14mu} ({GPD})}{\left\lbrack \left( {{{Produced}\mspace{14mu} {Oil}\mspace{14mu} {Flow}} + {{Produced}\mspace{14mu} {Water}\mspace{14mu} {Flow}}} \right) \right\rbrack ({MBD})} \cdot 25.}} & (1)\end{matrix}$

An HPPT separation efficiency 216 can be based on per HPPT water outletflowmeter, given by Equation (2):

$\begin{matrix}{{{{HPPT}\mspace{14mu} {Separation}\mspace{14mu} {Efficiency}\mspace{14mu} (\%)} = {\frac{{1\text{-}{Hr}\mspace{14mu} {Rolling}\mspace{14mu} {Average}\mspace{14mu} {HPPT}\mspace{14mu} {Water}\mspace{14mu} ({MBD})} + {REC}_{HPPT}}{\begin{matrix}\left\lbrack \left( {{1\text{-}{Hr}\mspace{14mu} {Rolling}\mspace{14mu} {Average}\mspace{14mu} {Produced}\mspace{14mu} {Water}} +} \right. \right. \\{\left. \left. {REC}_{{PROD} - {WTR}} \right) \right\rbrack ({MBD})}\end{matrix}} \cdot 100}},} & (2)\end{matrix}$

where REC_(HPPT) is a reconciliation parameter coefficient for HPPTwater outlet flow, and REC_(PROD-WTR) is a reconciliation parametercoefficient for produced water flow.

A minimum demulsifier concentration 218 is a minimum allowed demulsifierconcentration as a function of the temperature. The concentration canprovide the dynamic low output limit for PID control of HPPT separationefficiency, as given by Equation (3). P01, P02, P03, and P04 arecoefficients in the equations below that can be developed based on curvefitting or linear regression. Each equation can have a differentcoefficient, so P01 in Equation (3) can be different than P01 inEquation (5).

MIN DEM CONC (ppm)=P01·(1−Hr Rolling Avg Crude Temperature)+P02  (3).

Despite the parameter values, a hard minimum limit can also be applied.It is important to consider that maximum limit always has to be aboveminimum limit.

A maximum demulsifier concentration 220 is a maximum allowed demulsifierconcentration as a function of the temperature. The concentrationprovides the dynamic high output limit for PID controllers of HPPTseparation efficiency and for the dehydrator voltage override, as givenby Equation (4):

MAX DEM CONC (ppm)=P03·(1−Hr Rolling Avg Crude Temperature)+P04  (4).

Despite the parameters values, a maximum (hard) limit can be defined forthis calculation. It is important to consider that a maximum limitalways has to be above minimum limit.

A minimum HPPT separation efficiency 222 is a minimum separationexpected at HPPT as a function of the temperature, as given by Equation(5):

MIN HPPT SEP (%)=P01·(1−Hr Rolling Avg Crude Temperature)² +P02·(1−HrRolling Avg Crude Temperature)+P03  (5).

Minimum separation efficiency here is expressed as a second-degreepolynomial. However, minimum separation efficiency can be expressed inother forms depending on how the process data is curve-fitted, such asin a linear equation, exponential, power, or in other ways.

Rolling average process variables can represent one-hour rollingaverages of the process variable that is measured. A one-hour rollingaverage HPPT water rate 224 is a rolling average of the water flow rateindication from the HPPT. A one-hour rolling average crude temperature226 is a rolling average of the gas temperature indication from theHPPT, and can be assumed to be the same temperature of the crude oil. Aone-hour rolling average produced water 228 is the rolling average ofthe calculation of the GOSP produced water rate, such as the total waterrate minus the wash water rate. A one-hour rolling average produced dryoil 230 is the rolling average of the dry oil rate produced from theGOSP. Other one-hour rolling average process variables are possible.

The following process values and variables can be used as inputs of thecontrol scheme. An HPPT water rate 232 can measure a flowrate of waterfrom the HPPT. An HPPT gas temperature 234 can indicated a temperatureof gas from the HPPT, representing the temperature of the crude oil. Aninjection water rate 236 can indicate a total water rate from the GOSPwhich is being injected back into the reservoir. A wash water rate 238can indicate a fresh water rate used for a crude desalting process. Adry crude rate 240 can indicate a total produced oil rate from the GOSP.Other process values and variables are possible.

An HPPT separation efficiency controller can serve as the mastercontroller that determines the amount of demulsifier required, such as aconcentration target, based on the real performance of the HPPT that ismeasured online. The HPPT separation efficiency controller can send itsoutput to the demulsifier concentration controller, such as using ahigh-value selector. The HPPT separation efficiency controller caninclude some special features to accomplish its control function,including the following settings. First, a process value (PV) can bedetermined from a calculation which is filtered, such as using aone-minute scan, to avoid extra noise. Second, an HPPT separation setpoint required can be dynamic based on the temperature. For example, fora given GOSP and feed, the temperature can be the major disturbance thataffects HPPT separation efficiency. It may not be practical, norachievable with reasonable demulsifier consumptions, to entirelycompensate for the temperature effect by manipulating demulsifier.Therefore, different set points can be provided as a function of thetemperature. The separator can be required to achieve a certain marginover the minimum proven efficiency of the separator, according tohistorical data in a steady state. Third, dynamic limits of the output,including maximum and minimum limits, can be provided as a function ofthe temperature. The dynamic limits can be a key feature to ensure aproper utilization of demulsifier. Equations to calculate these dynamiclimits can be based on historical steady-state and plant-specificprocess data analysis. Fourth, the HPPT separation efficiency controllercan be tuned as a steady state controller, allowing for the provision oflow gain and integral times. Fifth, non-linear (gap) gain reduction canbe provided to reduce any remaining noise effect on demulsifieradjustments.

In some implementations, other functional blocks can be added tooverride the HPPT separation efficiency controller. For example, anadditional functional block can be added that controls a dehydratoremulsion layer profile, and other functional blocks can be added thatperform other functions.

FIGS. 3A-3E collectively illustrate a block diagram 300 of an exampleintegration of a control scheme and various processes, according to animplementation. Oil flows go through HPPT 302, an LPPT 304, dehydrator306 a, and desalter 306 b to product pipeline. Water flows from HPPT302, dehydrator 306 a and desalter 306 b flows to WOSEP 308. Water fromWOSEP 308 is injected with disposal water injection pumps 320 into areservoir. Controller inputs 310 b-310 n provide inputs into theprocess. The process also uses a local switch board 312, crude chargepump stations 314, a wash water mixing valve station 316, a local switchboard 318, and disposal water injection pumps 320. Other components arepossible.

Referring to FIG. 3D, logic components 322-342 control demulsifieramounts, as previously described, with reference to FIG. 2 for similarcomponents. Functions 346 used in some of the logic components 322-342identify numbered inputs 344 that are illustrated at various points inFIGS. 3A-3E. In FIG. 3D, measured process variables are used in thefunctions 346 are one hour rolling averages.

FIG. 4 is a flowchart illustrating an example method 400 for controllingHPPT separation efficiency, according to an implementation. For clarityof presentation, the description that follows generally describes method400 in the context of the other figures in this description. However, itwill be understood that method 400 may be performed, for example, by anysuitable system, environment, software, and hardware, or a combinationof systems, environments, software, and hardware as appropriate. In someimplementations, various steps of method 400 can be run in parallel, incombination, in loops, or in any order.

At 402, a feedback control scheme is implemented that includescontrolling a separation efficiency for a high-pressure production trap(HPPT) by manipulating the demulsifier concentration. For example, thefeedback control scheme controlled by the method 400 can be implementedby elements of the smart demulsifier control architecture 200. In someimplementations, the feedback control scheme that is implementedincludes sub-steps 404-408. From 402, method 400 proceeds to 404.

At 404, a minimum target separation efficiency and a maximum targetseparation efficiency are each determined as a function of temperatureand based on correlations of historical process data. For example, asgiven by Equation (5), the minimum HPPT separation efficiency 222 can becalculated as a function of the temperature, and the high selector 206can select the highest value (maximum), also based on temperature. From404, method 400 proceeds to 406.

At 406, a target separation efficiency is identified that is between theminimum target separation efficiency and the maximum target separationefficiency. As an example, the HPPT separation efficiency PID controller210 can determine the target separation efficiency using the minimum andmaximum target separation efficiencies. In some implementations,identifying the target separation efficiency includes receiving, from anoperator, input specifying an increase to an expected separationperformance by a certain margin. For example, the master logic block 212can automatically provide the set point for the HPPT separationefficiency PID controller 210 based on an observed temperature and amargin entered by an operator, such as up to a certain percentagegreater than a minimum separation efficiency. From 406, method 400proceeds to 408.

At 408, a demulsifier dosage that is used in calculating the separationefficiency is adjusted between a minimum demulsifier concentration and amaximum demulsifier concentration. For example, the demulsifierconcentration PID controller 204 can set the demulsifier dosage based atleast on the target separation efficiency. The adjusting can includesteps 410-414. From 408, method 400 proceeds to 410.

At 410, a determination is made as to whether the separation efficiencyis below or above the target separation efficiency. At 412, if it isdetermined that the separation efficiency is below the target separationefficiency, then the demulsifier dosage is adjusted upward (using a PIDcontroller) but not to exceed a maximum dosage concentration. Otherwise,at 414, if it is determined that the separation efficiency is above thetarget separation efficiency, then the demulsifier dosage is adjusteddownward (using the PID controller) above a minimum dosageconcentration. The flow indication controller 202, for example, canadjust the demulsifier dosage downward or upward based on thedetermination at 410. From 412 and 414, method 400 stops.

In some implementations, the method 400 also includes determining thatan upset has occurred in a dehydrator and using another PID controllerhaving more aggressive tuning than a current PID controller to overridedemulsifier concentration to mitigate the upset. For example, theefficiency calculations can be based on reconciled values to account forinstrument measurement errors and closure of the water balance.

FIG. 5 is a block diagram of an example computer system 500 used toprovide computational functionalities associated with describedalgorithms, methods, functions, processes, flows, and procedures, asdescribed in the instant disclosure, according to an implementation. Theillustrated computer 502 is intended to encompass any computing devicesuch as a server, desktop computer, laptop/notebook computer, wirelessdata port, smart phone, personal data assistant (PDA), tablet computingdevice, one or more processors within these devices, or any othersuitable processing device, including physical or virtual instances (orboth) of the computing device. Additionally, the computer 502 maycomprise a computer that includes an input device, such as a keypad,keyboard, touch screen, or other device that can accept userinformation, and an output device that conveys information associatedwith the operation of the computer 502, including digital data, visual,or audio information (or a combination of information), or a graphicaluser interface (GUI).

The computer 502 can serve in a role as a client, network component, aserver, a database or other persistency, or any other component (or acombination of roles) of a computer system for performing the subjectmatter described in the instant disclosure. The illustrated computer 502is communicably coupled with a network 530 (for example, any computernetwork described with respect to the instant subject matter). In someimplementations, one or more components of the computer 502 may beconfigured to operate within environments, includingcloud-computing-based, local, global, or other environment (or acombination of environments).

At a high level, the computer 502 is an electronic computing deviceoperable to receive, transmit, process, store, or manage data andinformation associated with the described subject matter. According tosome implementations, the computer 502 may also include or becommunicably coupled with an application server, e-mail server, webserver, caching server, streaming data server, or other server (or acombination of servers).

The computer 502 can receive requests over network 530 from a clientapplication (for example, executing on another computer 502) and respondto the received requests by processing the received requests using anappropriate software application(s). In addition, requests may also besent to the computer 502 from internal users (for example, from acommand console or by other appropriate access method), external orthird-parties, other automated applications, as well as any otherappropriate entities, individuals, systems, or computers.

Each of the components of the computer 502 can communicate using asystem bus 503. In some implementations, any or all of the components ofthe computer 502, hardware or software (or a combination of bothhardware and software), may interface with each other or the interface504 (or a combination of both), over the system bus 503 using anapplication programming interface (API) 512 or a service layer 513 (or acombination of the API 512 and service layer 513). The API 512 mayinclude specifications for routines, data structures, and objectclasses. The API 512 may be either computer-language independent ordependent and refer to a complete interface, a single function, or evena set of APIs. The service layer 513 provides software services to thecomputer 502 or other components (whether or not illustrated) that arecommunicably coupled to the computer 502. The functionality of thecomputer 502 may be accessible for all service consumers using thisservice layer. Software services, such as those provided by the servicelayer 513, provide reusable, defined functionalities through a definedinterface. For example, the interface may be software written in JAVA,C++, or other suitable language providing data in extensible markuplanguage (XML) format or other suitable format. While illustrated as anintegrated component of the computer 502, alternative implementationsmay illustrate the API 512 or the service layer 513 as stand-alonecomponents in relation to other components of the computer 502 or othercomponents (whether or not illustrated) that are communicably coupled tothe computer 502. Moreover, any or all parts of the API 512 or theservice layer 513 may be implemented as child or sub-modules of anothersoftware module, enterprise application, or hardware module withoutdeparting from the scope of this disclosure.

The computer 502 includes an interface 504. Although illustrated as asingle interface 504 in FIG. 5, two or more interfaces 504 may be usedaccording to particular needs, desires, or particular implementations ofthe computer 502. The interface 504 is used by the computer 502 forcommunicating with other systems that are connected to the network 530(whether illustrated or not) in a distributed environment. Generally,the interface 504 comprises logic encoded in software or hardware (or acombination of software and hardware) and is operable to communicatewith the network 530. More specifically, the interface 504 may comprisesoftware supporting one or more communication protocols associated withcommunications such that the network 530 or interface's hardware isoperable to communicate physical signals within and outside of theillustrated computer 502.

The computer 502 includes a processor 505. Although illustrated as asingle processor 505 in FIG. 5, two or more processors may be usedaccording to particular needs, desires, or particular implementations ofthe computer 502. Generally, the processor 505 executes instructions andmanipulates data to perform the operations of the computer 502 and anyalgorithms, methods, functions, processes, flows, and procedures asdescribed in the instant disclosure.

The computer 502 also includes a database 506 that can hold data for thecomputer 502 or other components (or a combination of both) that can beconnected to the network 530 (whether illustrated or not). For example,database 506 can be an in-memory, conventional, or other type ofdatabase storing data consistent with this disclosure. In someimplementations, database 506 can be a combination of two or moredifferent database types (for example, a hybrid in-memory andconventional database) according to particular needs, desires, orparticular implementations of the computer 502 and the describedfunctionality. Although illustrated as a single database 506 in FIG. 5,two or more databases (of the same or combination of types) can be usedaccording to particular needs, desires, or particular implementations ofthe computer 502 and the described functionality. While database 506 isillustrated as an integral component of the computer 502, in alternativeimplementations, database 506 can be external to the computer 502.

The computer 502 also includes a memory 507 that can hold data for thecomputer 502 or other components (or a combination of both) that can beconnected to the network 530 (whether illustrated or not). For example,memory 507 can be random access memory (RAM), read-only memory (ROM),optical, magnetic, and the like, storing data consistent with thisdisclosure. In some implementations, memory 507 can be a combination oftwo or more different types of memory (for example, a combination of RAMand magnetic storage) according to particular needs, desires, orparticular implementations of the computer 502 and the describedfunctionality. Although illustrated as a single memory 507 in FIG. 5,two or more memories 507 (of the same or combination of types) can beused according to particular needs, desires, or particularimplementations of the computer 502 and the described functionality.While memory 507 is illustrated as an integral component of the computer502, in alternative implementations, memory 507 can be external to thecomputer 502.

The application 508 is an algorithmic software engine providingfunctionality according to particular needs, desires, or particularimplementations of the computer 502, particularly with respect tofunctionality described in this disclosure. For example, application 508can serve as one or more components, modules, or applications. Further,although illustrated as a single application 508, the application 508may be implemented as multiple applications 508 on the computer 502. Inaddition, although illustrated as integral to the computer 502, inalternative implementations, the application 508 can be external to thecomputer 502.

The computer 502 can also include a power supply 514. The power supply514 can include a rechargeable or non-rechargeable battery that can beconfigured to be either user- or non-user-replaceable. In someimplementations, the power supply 514 can include power-conversion ormanagement circuits (including recharging, standby, or other powermanagement functionality). In some implementations, the power-supply 514can include a power plug to allow the computer 502 to be plugged into awall socket or other power source to, for example, power the computer502 or recharge a rechargeable battery.

There may be any number of computers 502 associated with, or externalto, a computer system containing computer 502, each computer 502communicating over network 530. Further, the term “client,” “user,” andother appropriate terminology may be used interchangeably, asappropriate, without departing from the scope of this disclosure.Moreover, this disclosure contemplates that many users may use onecomputer 502, or that one user may use multiple computers 502.

Described implementations of the subject matter can include one or morefeatures, alone or in combination.

For example, in a first implementation, computer-implemented method cancontrol demulsifier dosage. The method includes implementing a feedbackcontrol scheme including controlling a separation efficiency for ahigh-pressure production trap (HPPT) by manipulating the demulsifierconcentration. Implementing the feedback control scheme includes:determining, as a function of temperature and based on correlations ofhistorical process data, a minimum target separation efficiency and amaximum target separation efficiency; identifying a target separationefficiency that is between the minimum target separation efficiency andthe maximum target separation efficiency; and adjusting a demulsifierdosage, used in calculating the separation efficiency, between a minimumdemulsifier concentration and a maximum demulsifier concentration. Theadjusting includes: when the separation efficiency is below the targetseparation efficiency, adjusting, using a PID controller, thedemulsifier dosage upward but not to exceed a maximum dosageconcentration; and when the separation efficiency is above the targetseparation efficiency, adjusting, using the PID controller, thedemulsifier dosage downward above a minimum dosage concentration.

The foregoing and other described implementations can each, optionally,include one or more of the following features:

A first feature, combinable with any of the following features,identifying the target separation efficiency includes receiving, from anoperator, input specifying an increase to an expected separationperformance by a certain margin.

A second feature, combinable with any of the previous or followingfeatures, the minimum demulsifier concentration and the maximumdemulsifier concentration are determined through correlations and are afunction of temperature.

A third feature, combinable with any of the previous or followingfeatures, the method further includes determining that an upset hasoccurred in a dehydrator and using another PID controller having moreaggressive tuning than a current PID controller to override demulsifierconcentration to mitigate the upset.

A fourth feature, combinable with any of the previous or followingfeatures, the method further includes determining efficiencycalculations that are based on reconciled values to account forinstrument measurement errors and closure of the water balance.

A fifth feature, combinable with any of the previous or followingfeatures, adjusting the demulsifier dosage includes maintaining thedemulsifier dosage regardless of crude and water flow oscillations.

A sixth feature, combinable with any of the previous or followingfeatures maintaining the demulsifier dosage includes using a controlledvariable used as a demulsifier concentration, a manipulated variableused as a demulsifier flow set point, and disturbances variablesincluding a dry crude flow oscillation, a produced water flowoscillation, and a demulsifier flow oscillation.

In a second implementation, non-transitory, computer-readable mediumstoring one or more instructions executable by a computer system toperform operations for controlling demulsifier dosage. The operationsinclude implementing a feedback control scheme including controlling aseparation efficiency for a high-pressure production trap (HPPT) bymanipulating the demulsifier concentration. Implementing the feedbackcontrol scheme includes: determining, as a function of temperature andbased on correlations of historical process data, a minimum targetseparation efficiency and a maximum target separation efficiency;identifying a target separation efficiency that is between the minimumtarget separation efficiency and the maximum target separationefficiency; and adjusting a demulsifier dosage, used in calculating theseparation efficiency, between a minimum demulsifier concentration and amaximum demulsifier concentration. The adjusting includes: when theseparation efficiency is below the target separation efficiency,adjusting, using a PID controller, the demulsifier dosage upward but notto exceed a maximum dosage concentration; and when the separationefficiency is above the target separation efficiency, adjusting, usingthe PID controller, the demulsifier dosage downward above a minimumdosage concentration.

The foregoing and other described implementations can each, optionally,include one or more of the following features:

A first feature, combinable with any of the following features,identifying the target separation efficiency includes receiving, from anoperator, input specifying an increase to an expected separationperformance by a certain margin.

A second feature, combinable with any of the previous or followingfeatures, the minimum demulsifier concentration and the maximumdemulsifier concentration are determined through correlations and are afunction of temperature.

A third feature, combinable with any of the previous or followingfeatures, the operations further include determining that an upset hasoccurred in a dehydrator and using another PID controller having moreaggressive tuning than a current PID controller to override demulsifierconcentration to mitigate the upset.

A fourth feature, combinable with any of the previous or followingfeatures, the operations further include determining efficiencycalculations that are based on reconciled values to account forinstrument measurement errors and closure of the water balance.

A fifth feature, combinable with any of the previous or followingfeatures, adjusting the demulsifier dosage includes maintaining thedemulsifier dosage regardless of crude and water flow oscillations.

A sixth feature, combinable with any of the previous or followingfeatures maintaining the demulsifier dosage includes using a controlledvariable used as a demulsifier concentration, a manipulated variableused as a demulsifier flow set point, and disturbances.

In a third implementation, a computer-implemented system comprises acomputer memory and a hardware processor interoperably coupled with thecomputer memory and configured to perform operations for controllingdemulsifier dosage. The operations include implementing a feedbackcontrol scheme including controlling a separation efficiency for ahigh-pressure production trap (HPPT) by manipulating the demulsifierconcentration. Implementing the feedback control scheme includes:determining, as a function of temperature and based on correlations ofhistorical process data, a minimum target separation efficiency and amaximum target separation efficiency; identifying a target separationefficiency that is between the minimum target separation efficiency andthe maximum target separation efficiency; and adjusting a demulsifierdosage, used in calculating the separation efficiency, between a minimumdemulsifier concentration and a maximum demulsifier concentration. Theadjusting includes: when the separation efficiency is below the targetseparation efficiency, adjusting, using a PID controller, thedemulsifier dosage upward but not to exceed a maximum dosageconcentration; and when the separation efficiency is above the targetseparation efficiency, adjusting, using the PID controller, thedemulsifier dosage downward above a minimum dosage concentration.

The foregoing and other described implementations can each, optionally,include one or more of the following features:

A first feature, combinable with any of the following features,identifying the target separation efficiency includes receiving, from anoperator, input specifying an increase to an expected separationperformance by a certain margin.

A second feature, combinable with any of the previous or followingfeatures, the minimum demulsifier concentration and the maximumdemulsifier concentration are determined through correlations and are afunction of temperature.

A third feature, combinable with any of the previous or followingfeatures, the operations further include determining that an upset hasoccurred in a dehydrator and using another PID controller having moreaggressive tuning than a current PID controller to override demulsifierconcentration to mitigate the upset.

A fourth feature, combinable with any of the previous or followingfeatures, the operations further include determining efficiencycalculations that are based on reconciled values to account forinstrument measurement errors and closure of the water balance.

A fifth feature, combinable with any of the previous or followingfeatures, adjusting the demulsifier dosage includes maintaining thedemulsifier dosage regardless of crude and water flow oscillations.

Implementations of the subject matter and the functional operationsdescribed in this specification can be implemented in digital electroniccircuitry, in tangibly embodied computer software or firmware, incomputer hardware, including the structures disclosed in thisspecification and their structural equivalents, or in combinations ofone or more of them. Implementations of the subject matter described inthis specification can be implemented as one or more computer programs,that is, one or more modules of computer program instructions encoded ona tangible, non-transitory, computer-readable computer-storage mediumfor execution by, or to control the operation of, data processingapparatus. Alternatively, or additionally, the program instructions canbe encoded in/on an artificially generated propagated signal, forexample, a machine-generated electrical, optical, or electromagneticsignal that is generated to encode information for transmission tosuitable receiver apparatus for execution by a data processingapparatus. The computer-storage medium can be a machine-readable storagedevice, a machine-readable storage substrate, a random or serial accessmemory device, or a combination of computer-storage mediums.

The term “real-time,” “real time,” “realtime,” “real (fast) time (RFT),”“near(ly) real-time (NRT),” “quasi real-time,” or similar terms (asunderstood by one of ordinary skill in the art), means that an actionand a response are temporally proximate such that an individualperceives the action and the response occurring substantiallysimultaneously. For example, the time difference for a response todisplay (or for an initiation of a display) of data following theindividual's action to access the data may be less than 1 ms, less than1 sec., or less than 5 secs. While the requested data need not bedisplayed (or initiated for display) instantaneously, it is displayed(or initiated for display) without any intentional delay, taking intoaccount processing limitations of a described computing system and timerequired to, for example, gather, accurately measure, analyze, process,store, or transmit the data.

The terms “data processing apparatus,” “computer,” or “electroniccomputer device” (or equivalent as understood by one of ordinary skillin the art) refer to data processing hardware and encompass all kinds ofapparatus, devices, and machines for processing data, including by wayof example, a programmable processor, a computer, or multiple processorsor computers. The apparatus can also be or further include specialpurpose logic circuitry, for example, a central processing unit (CPU),an FPGA (field programmable gate array), or an ASIC(application-specific integrated circuit). In some implementations, thedata processing apparatus or special purpose logic circuitry (or acombination of the data processing apparatus or special purpose logiccircuitry) may be hardware- or software-based (or a combination of bothhardware- and software-based). The apparatus can optionally include codethat creates an execution environment for computer programs, forexample, code that constitutes processor firmware, a protocol stack, adatabase management system, an operating system, or a combination ofexecution environments. The present disclosure contemplates the use ofdata processing apparatuses with or without conventional operatingsystems, for example LINUX, UNIX, WINDOWS, MAC OS, ANDROID, IOS, or anyother suitable conventional operating system.

A computer program, which may also be referred to or described as aprogram, software, a software application, a module, a software module,a script, or code can be written in any form of programming language,including compiled or interpreted languages, or declarative orprocedural languages, and it can be deployed in any form, including as astand-alone program or as a module, component, subroutine, or other unitsuitable for use in a computing environment. A computer program may, butneed not, correspond to a file in a file system. A program can be storedin a portion of a file that holds other programs or data, for example,one or more scripts stored in a markup language document, in a singlefile dedicated to the program in question, or in multiple coordinatedfiles, for example, files that store one or more modules, sub-programs,or portions of code. A computer program can be deployed to be executedon one computer or on multiple computers that are located at one site ordistributed across multiple sites and interconnected by a communicationnetwork. While portions of the programs illustrated in the variousfigures are illustrated as individual modules that implement the variousfeatures and functionality through various objects, methods, or otherprocesses, the programs may instead include a number of sub-modules,third-party services, components, libraries, and such, as appropriate.Conversely, the features and functionality of various components can becombined into single components, as appropriate. Thresholds used to makecomputational determinations can be statically, dynamically, or bothstatically and dynamically determined.

The methods, processes, or logic flows described in this specificationcan be performed by one or more programmable computers executing one ormore computer programs to perform functions by operating on input dataand generating output. The methods, processes, or logic flows can alsobe performed by, and apparatus can also be implemented as, specialpurpose logic circuitry, for example, a CPU, an FPGA, or an ASIC.

Computers suitable for the execution of a computer program can be basedon general or special purpose microprocessors, both, or any other kindof CPU. Generally, a CPU will receive instructions and data from aread-only memory (ROM) or a random access memory (RAM), or both. Theessential elements of a computer are a CPU, for performing or executinginstructions, and one or more memory devices for storing instructionsand data. Generally, a computer will also include, or be operativelycoupled to, receive data from or transfer data to, or both, one or moremass storage devices for storing data, for example, magnetic,magneto-optical disks, or optical disks. However, a computer need nothave such devices. Moreover, a computer can be embedded in anotherdevice, for example, a mobile telephone, a personal digital assistant(PDA), a mobile audio or video player, a game console, a globalpositioning system (GPS) receiver, or a portable storage device, forexample, a universal serial bus (USB) flash drive, to name just a few.

Computer-readable media (transitory or non-transitory, as appropriate)suitable for storing computer program instructions and data includes allforms of non-volatile memory, media and memory devices, including by wayof example semiconductor memory devices, for example, erasableprogrammable read-only memory (EPROM), electrically erasableprogrammable read-only memory (EEPROM), and flash memory devices;magnetic disks, for example, internal hard disks or removable disks;magneto-optical disks; and CD-ROM, DVD+/−R, DVD-RAM, and DVD-ROM disks.The memory may store various objects or data, including caches, classes,frameworks, applications, backup data, jobs, web pages, web pagetemplates, database tables, repositories storing dynamic information,and any other appropriate information including any parameters,variables, algorithms, instructions, rules, constraints, or referencesthereto. Additionally, the memory may include any other appropriatedata, such as logs, policies, security or access data, reporting files,as well as others. The processor and the memory can be supplemented by,or incorporated in, special purpose logic circuitry.

To provide for interaction with a user, implementations of the subjectmatter described in this specification can be implemented on a computerhaving a display device, for example, a CRT (cathode ray tube), LCD(liquid crystal display), LED (Light Emitting Diode), or plasma monitor,for displaying information to the user and a keyboard and a pointingdevice, for example, a mouse, trackball, or trackpad by which the usercan provide input to the computer. Input may also be provided to thecomputer using a touchscreen, such as a tablet computer surface withpressure sensitivity, a multi-touch screen using capacitive or electricsensing, or other type of touchscreen. Other kinds of devices can beused to provide for interaction with a user as well; for example,feedback provided to the user can be any form of sensory feedback, forexample, visual feedback, auditory feedback, or tactile feedback; andinput from the user can be received in any form, including acoustic,speech, or tactile input. In addition, a computer can interact with auser by sending documents to and receiving documents from a device thatis used by the user; for example, by sending web pages to a web browseron a user's client device in response to requests received from the webbrowser.

The term “graphical user interface,” or “GUI,” may be used in thesingular or the plural to describe one or more graphical user interfacesand each of the displays of a particular graphical user interface.Therefore, a GUI may represent any graphical user interface, includingbut not limited to, a web browser, a touch screen, or a command lineinterface (CLI) that processes information and efficiently presents theinformation results to the user. In general, a GUI may include aplurality of user interface (UI) elements, some or all associated with aweb browser, such as interactive fields, pull-down lists, and buttons.These and other UI elements may be related to or represent the functionsof the web browser.

Implementations of the subject matter described in this specificationcan be implemented in a computing system that includes a back-endcomponent, for example, as a data server, or that includes a middlewarecomponent, for example, an application server, or that includes afront-end component, for example, a client computer having a graphicaluser interface or a Web browser through which a user can interact withan implementation of the subject matter described in this specification,or any combination of one or more such back-end, middleware, orfront-end components. The components of the system can be interconnectedby any form or medium of wireline or wireless digital data communication(or a combination of data communication), for example, a communicationnetwork. Examples of communication networks include a local area network(LAN), a radio access network (RAN), a metropolitan area network (MAN),a wide area network (WAN), Worldwide Interoperability for MicrowaveAccess (WIMAX), a wireless local area network (WLAN) using, for example,802.11a/b/g/n or 802.20 (or a combination of 802.11x and 802.20 or otherprotocols consistent with this disclosure), all or a portion of theInternet, or any other communication system or systems at one or morelocations (or a combination of communication networks). The network maycommunicate with, for example, Internet Protocol (IP) packets, FrameRelay frames, Asynchronous Transfer Mode (ATM) cells, voice, video,data, or other suitable information (or a combination of communicationtypes) between network addresses.

The computing system can include clients and servers. A client andserver are generally remote from each other and typically interactthrough a communication network. The relationship of client and serverarises by virtue of computer programs running on the respectivecomputers and having a client-server relationship to each other.

While this specification contains many specific implementation details,these should not be construed as limitations on the scope of anyinvention or on the scope of what may be claimed, but rather asdescriptions of features that may be specific to particularimplementations of particular inventions. Certain features that aredescribed in this specification in the context of separateimplementations can also be implemented, in combination, in a singleimplementation. Conversely, various features that are described in thecontext of a single implementation can also be implemented in multipleimplementations, separately, or in any suitable sub-combination.Moreover, although previously described features may be described asacting in certain combinations and even initially claimed as such, oneor more features from a claimed combination can, in some cases, beexcised from the combination, and the claimed combination may bedirected to a sub-combination or variation of a sub-combination.

Particular implementations of the subject matter have been described.Other implementations, alterations, and permutations of the describedimplementations are within the scope of the following claims as will beapparent to those skilled in the art. While operations are depicted inthe drawings or claims in a particular order, this should not beunderstood as requiring that such operations be performed in theparticular order illustrated or in sequential order, or that allillustrated operations be performed (some operations may be consideredoptional), to achieve desirable results. In certain circumstances,multitasking or parallel processing (or a combination of multitaskingand parallel processing) may be advantageous and performed as deemedappropriate.

Moreover, the separation or integration of various system modules andcomponents in the previously described implementations should not beunderstood as requiring such separation or integration in allimplementations, and it should be understood that the described programcomponents and systems can generally be integrated together in a singlesoftware product or packaged into multiple software products.

Accordingly, the previously described example implementations do notdefine or constrain this disclosure. Other changes, substitutions, andalterations are also possible without departing from the spirit andscope of this disclosure.

Furthermore, any claimed implementation is considered to be applicableto at least a computer-implemented method; a non-transitory,computer-readable medium storing computer-readable instructions toperform the computer-implemented method; and a computer systemcomprising a computer memory interoperably coupled with a hardwareprocessor configured to perform the computer-implemented method or theinstructions stored on the non-transitory, computer-readable medium.

What is claimed is:
 1. A computer-implemented method, comprising:implementing a feedback control scheme including controlling aseparation efficiency for a high-pressure production trap (HPPT) bymanipulating the demulsifier concentration, including: determining, as afunction of temperature and based on correlations of historical processdata, a minimum target separation efficiency and a maximum targetseparation efficiency; identifying a target separation efficiency thatis between the minimum target separation efficiency and the maximumtarget separation efficiency; and adjusting a demulsifier dosage, usedin calculating the separation efficiency, between a minimum demulsifierconcentration and a maximum demulsifier concentration, the adjustingincluding: when the separation efficiency is below the target separationefficiency, adjusting, using a PID controller, the demulsifier dosageupward but not to exceed a maximum dosage concentration; and when theseparation efficiency is above the target separation efficiency,adjusting, using the PID controller, the demulsifier dosage downwardabove a minimum dosage concentration.
 2. The computer-implemented methodof claim 1, wherein identifying the target separation efficiencyincludes receiving, from an operator, input specifying an increase to anexpected separation performance by a certain margin.
 3. Thecomputer-implemented method of claim 1, wherein the minimum demulsifierconcentration and the maximum demulsifier concentration are determinedthrough correlations and are a function of temperature.
 4. Thecomputer-implemented method of claim 1, further comprising: determiningthat an upset has occurred in a dehydrator; and using another PIDcontroller having more aggressive tuning than a current PID controllerto override demulsifier concentration to mitigate the upset.
 5. Thecomputer-implemented method of claim 1, further comprising determiningefficiency calculations that are based on reconciled values to accountfor instrument measurement errors and closure of the water balance. 6.The computer-implemented method of claim 1, wherein adjusting thedemulsifier dosage includes maintaining the demulsifier dosageregardless of crude and water flow oscillations.
 7. Thecomputer-implemented method of claim 6, wherein maintaining thedemulsifier dosage includes using a controlled variable used as ademulsifier concentration, a manipulated variable used as a demulsifierflow set point, and disturbances variables including a dry crude flowoscillation, a produced water flow oscillation, and a demulsifier flowoscillation.
 8. A non-transitory, computer-readable medium storing oneor more instructions executable by a computer system to performoperations comprising: implementing a feedback control scheme includingcontrolling a separation efficiency for a high-pressure production trap(HPPT) by manipulating the demulsifier concentration, including:determining, as a function of temperature and based on correlations ofhistorical process data, a minimum target separation efficiency and amaximum target separation efficiency; identifying a target separationefficiency that is between the minimum target separation efficiency andthe maximum target separation efficiency; and adjusting a demulsifierdosage, used in calculating the separation efficiency, between a minimumdemulsifier concentration and a maximum demulsifier concentration, theadjusting including: when the separation efficiency is below the targetseparation efficiency, adjusting, using a PID controller, thedemulsifier dosage upward but not to exceed a maximum dosageconcentration; and when the separation efficiency is above the targetseparation efficiency, adjusting, using the PID controller, thedemulsifier dosage downward above a minimum dosage concentration.
 9. Thenon-transitory, computer-readable medium of claim 8, wherein identifyingthe target separation efficiency includes receiving, from an operator,input specifying an increase to an expected separation performance by acertain margin.
 10. The non-transitory, computer-readable medium ofclaim 8, wherein the minimum demulsifier concentration and the maximumdemulsifier concentration are determined through correlations and are afunction of temperature.
 11. The non-transitory, computer-readablemedium of claim 8, the operations further comprising: determining thatan upset has occurred in a dehydrator; and using another PID controllerhaving more aggressive tuning than a current PID controller to overridedemulsifier concentration to mitigate the upset.
 12. Thecomputer-readable medium of claim 8, the operations further comprisingdetermining efficiency calculations that are based on reconciled valuesto account for instrument measurement errors and closure of the waterbalance.
 13. The computer-readable medium of claim 8, wherein adjustingthe demulsifier dosage includes maintaining the demulsifier dosageregardless of crude and water flow oscillations.
 14. Thecomputer-readable medium of claim 13, wherein maintaining thedemulsifier dosage includes using a controlled variable used as ademulsifier concentration, a manipulated variable used as a demulsifierflow set point, and disturbances variables including a dry crude flowoscillation, a produced water flow oscillation, and a demulsifier flowoscillation.
 15. A computer-implemented system, comprising: a computermemory; and a hardware processor interoperably coupled with the computermemory and configured to perform operations comprising: implementing afeedback control scheme including controlling a separation efficiencyfor a high-pressure production trap (HPPT) by manipulating thedemulsifier concentration, including: determining, as a function oftemperature and based on correlations of historical process data, aminimum target separation efficiency and a maximum target separationefficiency; identifying a target separation efficiency that is betweenthe minimum target separation efficiency and the maximum targetseparation efficiency; and adjusting a demulsifier dosage, used incalculating the separation efficiency, between a minimum demulsifierconcentration and a maximum demulsifier concentration, the adjustingincluding: when the separation efficiency is below the target separationefficiency, adjusting, using a PID controller, the demulsifier dosageupward but not to exceed a maximum dosage concentration; and when theseparation efficiency is above the target separation efficiency,adjusting, using the PID controller, the demulsifier dosage downwardabove a minimum dosage concentration.
 16. The computer-implementedsystem of claim 15, wherein identifying the target separation efficiencyincludes receiving, from an operator, input specifying an increase to anexpected separation performance by a certain margin.
 17. Thecomputer-implemented system of claim 15, wherein the minimum demulsifierconcentration and the maximum demulsifier concentration are determinedthrough correlations and are a function of temperature.
 18. Thecomputer-implemented system of claim 15, the operations furthercomprising: determining that an upset has occurred in a dehydrator; andusing another PID controller having more aggressive tuning than acurrent PID controller to override demulsifier concentration to mitigatethe upset.
 19. The computer-implemented system of claim 15, theoperations further comprising determining efficiency calculations thatare based on reconciled values to account for instrument measurementerrors and closure of the water balance.
 20. The computer-implementedsystem of claim 15, wherein adjusting the demulsifier dosage includesmaintaining the demulsifier dosage regardless of crude and water flowoscillations.